namespace C4F.DevKit.Bluetooth
{
    namespace FileTransferProfile
    {
        #region Using Directives
        using System;
        using System.Collections.Generic;
        using System.Text;
        using Resources;
        #endregion

        /// <summary>
        /// Class representing an asynchronous FileTransferProfile Request.
        /// </summary>
        internal class FTPRequest
        {
            #region Private Members

            /// <summary>
            /// The user-supplied state object supplied when the asynchronous 
            /// operation was requested.
            /// </summary>            
            object userstate;

            /// <summary>
            /// Type of the asynchronous FileTransferProfile operation.
            /// </summary>
            FTPRequestType requestType;
            /// <summary>
            /// The input parameters required for the asynchronous operation.
            /// </summary>
            object[] requestParameters;

            #endregion

            #region Public Properties

            /// <summary>
            /// Gets the type of the asynchronous FileTransferProfile operation.
            /// </summary>
            public FTPRequestType RequestType
            {
                get { return this.requestType; }
            }

            /// <summary>
            /// Gets the user-supplied state object supplied when the asynchronous
            /// operation was requested.
            /// </summary>
            public object UserState
            {
                get { return this.userstate; }
            }

            /// <summary>
            /// Gets the input parameters required for the asynchronous operation.
            /// </summary>
            public object[] RequestParameters
            {
                get { return this.requestParameters; }
            }

            #endregion

            #region Constructor
            /// <summary>
            /// Initializes the FTPRequest object.
            /// </summary>
            /// <param name="requestType">The type of asynchronous operation.
            /// </param>
            /// <param name="userState">The user-supplied state object supplied 
            /// when the asynchronous operation was requested.</param>
            /// <param name="requestParameters">The input parameters required for
            /// the asynchronous operation.</param>
            /// <exception cref="ArgumentException">Thrown when 
            /// when one of the arguments provided to the method is not valid.
            /// </exception>
            public FTPRequest(FTPRequestType requestType,
                              object userState,
                              params object[] requestParameters)
            {

                if (!Enum.IsDefined(typeof(FTPRequestType), requestType))
                    throw new ArgumentException
                                (FTPMessages.ErrorMsgInvalidRequestType,
                                 FTPMessages.RequestType);

                this.requestType = requestType;
                this.userstate = userState;
                this.requestParameters = requestParameters;
            }
            #endregion
        }

    }
}
